package com.legendshop.openportal.sdk.service;

import cn.hutool.core.lang.TypeReference;
import com.legendshop.openportal.sdk.model.OpenResult;
import com.legendshop.openportal.sdk.model.request.*;
import com.legendshop.openportal.sdk.model.request.v4.AfterSaleInfoV4Request;
import com.legendshop.openportal.sdk.model.response.AfterSaleApplyResponse;
import com.legendshop.openportal.sdk.model.response.AfterSaleInfoResponse;
import com.legendshop.openportal.sdk.model.response.AfterSaleSubmitResponse;
import com.legendshop.openportal.sdk.model.response.v4.AfterSaleInfoV4Response;

import java.util.List;

/**
 * 开放平台售后服务， 参见 OrderAfterSaleManageController
 * @author jzh
 * @version 1.0.0
 * @title OrderService
 * @date 2024/6/24 9:59
 * @description：
 */
public class AfterSaleService extends BaseService {

    /**
     * 选择订单售后服务类型页
     * @param request
     * @return
     */
    public static OpenResult<AfterSaleApplyResponse> apply(AfterSaleApplyRequest request) {
        return execute(request, AfterSaleApplyResponse.class);
    }

    /**
     * 提交售后
     * @param request
     * @return
     */
    public static OpenResult<AfterSaleSubmitResponse> applySubmit(AfterSaleSubmitRequest request) {
        return execute(request, AfterSaleSubmitResponse.class);
    }

    /**
     * 获取售后信息
     * @param request
     * @return
     */
    public static OpenResult<List<AfterSaleInfoResponse>> getAfsInfo(AfterSaleInfoRequest request) {
        return execute(request, new TypeReference<List<AfterSaleInfoResponse>>() {});
    }

    /**
     * 填写售后货运信息
     * @param request
     * @return
     */
    public static OpenResult<Void> expressInfo(AfterSaleExpressInfoRequest request) {
        return execute(request, Void.class);
    }

    /**
     * 取消售后申请
     * @param request
     * @return
     */
    public static OpenResult<Void> cancel(AfterSaleCancelRequest request) {
        return execute(request, Void.class);
    }

    //******************************************v4部分****************************************************


    /**
     * 获取售后信息
     * @param request
     * @return
     */
    public static OpenResult<List<AfterSaleInfoV4Response>> getAfsInfoV4(AfterSaleInfoV4Request request) {
        return execute(request, new TypeReference<List<AfterSaleInfoV4Response>>() {});
    }

}
